package com.deke.baby.service.impl;

import java.util.List;
import com.deke.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.deke.baby.mapper.BabyFamilyMemberMapper;
import com.deke.baby.domain.BabyFamilyMember;
import com.deke.baby.service.IBabyFamilyMemberService;

/**
 * 家庭成员Service业务层处理
 *
 * @author deke
 * @date 2023-06-28
 */
@Service
public class BabyFamilyMemberServiceImpl implements IBabyFamilyMemberService
{
    @Autowired
    private BabyFamilyMemberMapper babyFamilyMemberMapper;

    /**
     * 查询家庭成员
     *
     * @param id 家庭成员主键
     * @return 家庭成员
     */
    @Override
    public BabyFamilyMember selectBabyFamilyMemberById(Long id)
    {
        return babyFamilyMemberMapper.selectBabyFamilyMemberById(id);
    }

    /**
     * 查询家庭成员列表
     *
     * @param babyFamilyMember 家庭成员
     * @return 家庭成员
     */
    @Override
    public List<BabyFamilyMember> selectBabyFamilyMemberList(BabyFamilyMember babyFamilyMember)
    {
        return babyFamilyMemberMapper.selectBabyFamilyMemberList(babyFamilyMember);
    }

    /**
     * 新增家庭成员
     *
     * @param babyFamilyMember 家庭成员
     * @return 结果
     */
    @Override
    public int insertBabyFamilyMember(BabyFamilyMember babyFamilyMember)
    {
        babyFamilyMember.setCreateTime(DateUtils.getNowDate());
        return babyFamilyMemberMapper.insertBabyFamilyMember(babyFamilyMember);
    }

    /**
     * 修改家庭成员
     *
     * @param babyFamilyMember 家庭成员
     * @return 结果
     */
    @Override
    public int updateBabyFamilyMember(BabyFamilyMember babyFamilyMember)
    {
        babyFamilyMember.setUpdateTime(DateUtils.getNowDate());
        return babyFamilyMemberMapper.updateBabyFamilyMember(babyFamilyMember);
    }

    /**
     * 批量删除家庭成员
     *
     * @param ids 需要删除的家庭成员主键
     * @return 结果
     */
    @Override
    public int deleteBabyFamilyMemberByIds(Long[] ids)
    {
        return babyFamilyMemberMapper.deleteBabyFamilyMemberByIds(ids);
    }

    /**
     * 删除家庭成员信息
     *
     * @param id 家庭成员主键
     * @return 结果
     */
    @Override
    public int deleteBabyFamilyMemberById(Long id)
    {
        return babyFamilyMemberMapper.deleteBabyFamilyMemberById(id);
    }
}
